home *** CD-ROM | disk | FTP | other *** search
- New Routines
- ------------
-
- After some thought, a couple of new routines for further experimentation
- and interference with:
-
- ----------
- Name: swi
-
- Function: Enables users to call any SWI via providing a list of register
- values to use and a SWI number.
-
- Example:
- (swi 4 ; OS_ReadC
- '(0)) ; Must provide a list with at least one element,
- ; the rest are assumed to be zero if not provided.
-
- Will result in the character pressed being returned in register zero, i.e.
- if the user pressed 'A' then you would get
-
- '(65 0 0 0 0 0 0 0 0 0)
-
- as a result.
-
- Notes: It does not seem a good idea to try making Scheme multitask via
- providing calls that perform Wimp_Initialise and Wimp_Poll---this
- seems to result in a Mess (i.e. DONT do that then ;-)
-
- Registers are zeroed if not provided with values, i.e. if you call
- (swi n '(1 2 3))
- then the registers used for the swi call will be as follows:
- r0 r1 r2 r3 r4 r5 r6 r7 r8 r9
- 1 2 3 0 0 0 0 0 0 0
-
- Registers after the call are returned.
-
- Strings may be passed as register values as a pointer to the string
- as an integer is put into the register for the SWI call.
- ----------
- Name: _dehex
-
- Function: Enables users to convert from a string hexadecimal representation
- to the integer value.
-
- Example:
- (_dehex "f")
-
- returns the result 15.
-
- Notes: Typically of use in creating SWI calls where you have the hex value
- but are too lazy to get out your calculator to work out the decimal
- value. Hence you can create the second argument to swi via backquote
- and judicious use of ','.
- ----------
- Name: _makebuf
-
- Function: Makes a blank buffer that is n bytes big, and returns the pointer
- to the space allocated as an integer.
- (Actually, you get n+1 bytes, but the last one is a null for
- obvious reasons...)
-
- Example:
- (_makebuf 20)
-
- returns a pointer to a null terminated buffer capable of holding 20 bytes
- worth of information.
-
- Notes: Uses of this are creation of a buffer and then passing the value
- returned as value of a SWI register for a SWI call if space is needed.
-
- ----------
- Name: _dsptr
-
- Function: Dereferences a string pointer at a given address and returns the
- string found there.
- Example:
- (define a (_makebuf 5))
- (_dsptr a)
-
- will return " " or whatever happens to be in that buffer area pointed to
- by `a' at that time.
- ----------
- Name: _free
-
- Function: Frees memory associated with a given address passed as an integer.
-
- Example:
- (define a (_makebuf 5))
- ; do something with buffer pointed to by a--e.g. used for swi call
- (_free a)
-
- Notes: You should NOT rely on the contents of buffers that were allocated
- and subsequently freed via this means---it is more than likely the
- contents will be overwritten after the _free call and anything that
- then allocates memory thereafter.
- ----------
-
-
-
- ams
- 3/8/95